const fs = require("fs");

exports.getMime = function(extname){
    switch (extname) {
        case ".html":
            return "text/html";
            break;
        case ".css":
            return "text/css";
            break;
        case ".js":
            return "text/javascript";
            break;
        default:
            return "text/html";
            break;
    }
}

exports.getFileMime = function(extname){
    let data = fs.readFileSync("./data/mime.json");    //同步读取
    let mimeObj = JSON.parse(data.toString());
    return mimeObj[extname];
}